import request from '@/utils/request'

const module = '/admin/system/menu'
// 查询嵌套菜单
export const GetNestedMenus = () => {
  return request({
    url: `${module}/listNestedMenus`,
    method: 'GET',
  })
}
//删除指定菜单
export const DeleteMenuById = id => {
  return request({
    url: `${module}/deleteById/${id}`,
    method: 'DELETE',
  })
}
//新增菜单
export const SaveMenu = sysMenu => {
  return request({
    url: `${module}/save`,
    method: 'POST',
    data: sysMenu,
  })
}
//查询指定菜单
export const GetMeuById = id => {
  return request({
    url: `${module}/getById/${id}`,
    method: 'GET',
  })
}
//更新菜单
export const UpdateMenu = sysMenu => {
  return request({
    url: `${module}/update`,
    method: 'PUT',
    data: sysMenu,
  })
}
//根据角色id查询已分配的菜单id列表
export const GetMenuIdsByRoleId = roleId => {
  return request({
    url: `${module}/listMenuIdsByRoleId/${roleId}`,
    method: 'GET',
  })
}
